<?php

require_once dirname(__FILE__) . '/../../Rams.php';
require_once dirname(__FILE__) . '/FilterParams.php';

class Rams_Extension_FilterContent extends Raws_Extension_Content
{
  public function getDOM($doc = null)
  {
      $element = parent::getDOM($doc);
      if ($this->_params !== null) {
          $element->appendChild($this->_params->getDOM($element->ownerDocument));
      }
      return $element;
  }

  /**
   * Creates individual Entry objects of the appropriate type and
   * stores them as members of this entry based upon DOM data.
   *
   * @param DOMNode $child The DOMNode to process
   */
  protected function takeChildFromDOM($child)
  {
      $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
      
      switch ($absoluteNodeName) {
        case $this->lookupNamespace('raws') . ':' . 'params':
            $params = new Rams_Extension_FilterParams();
            $params->transferFromDOM($child);
            $this->_params = $params;
            break;
        default:
            parent::takeChildFromDOM($child);
            break;
      }
  }
    
}
